package filedemo;

public class Main5 {
    public static void main(String[] args) {
        try {
            java.io.File temp = java.io.File.createTempFile("testrunoobtmp", ".txt");
            System.out.println("文件路径: " + temp.getAbsolutePath());
            temp.deleteOnExit();
            java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter(temp));
            out.write("aString");
            System.out.println("临时文件已创建:");
            out.close();
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }
}
